package com.herohead;

import java.net.UnknownHostException;
import java.util.Date;




public class CDLogger {

	public static long getDateDiffMilliSeconds(Date StartDate, Date EndDate) {

		//in milliseconds
		long diff = EndDate.getTime() - StartDate.getTime();
		long diff1 = diff;
		return diff1;


	}

	public static long getDateDiffSeconds(Date StartDate, Date EndDate) {

		//in seconds
		long diff = EndDate.getTime() - StartDate.getTime();
		long diffSeconds = diff / 1000 % 60;
		return diffSeconds;


	}
	private final Misc m = new Misc();


	Date programStartTimeStamp;

	Date programStopTimeStamp;

	public void programStart(org.apache.log4j.Logger log) throws UnknownHostException {
		log.info("Program started");


		programStartTimeStamp = new Date();

		log.debug("Java version = " + m.getSystemInfoJavaVersion());
		log.debug("SystemHostName = " + m.getSystemLocalHostName());
	}
	public void programStop(org.apache.log4j.Logger log) {

		programStopTimeStamp = new Date();

		log.info("Program Stopped - ran for " + getDateDiffMilliSeconds(programStartTimeStamp,programStopTimeStamp)+ " millseconds");
	}
}
